package prj.common.bean;

import java.io.Serializable;
import java.util.ResourceBundle;

import javax.faces.context.FacesContext;

import org.apache.log4j.Logger;

public class FormHandlerBean implements Serializable {
	protected Logger logger = Logger.getLogger(this.getClass());
	private static final long serialVersionUID = 1L;
	public static final String DEFAULT_MSG_BUNDLE = "prj.common.DEFAULT_MSG_BUNDLE";

	private String formMsgSuccess;
	private String formMsgError;

	public String getFormMsgError() {
		return formMsgError;
	}
	public void setFormMsgError(String formMsgError) {
		this.formMsgError = formMsgError;
	}
	public String getFormMsgSuccess() {
		return formMsgSuccess;
	}
	public void setFormMsgSuccess(String formMsgSuccess) {
		this.formMsgSuccess = formMsgSuccess;
	}
	protected String handleFormMessage(String code) {
		FacesContext fc = FacesContext.getCurrentInstance();
		ResourceBundle rb = fc.getApplication().getResourceBundle(fc, fc.getExternalContext().getInitParameter(FormHandlerBean.DEFAULT_MSG_BUNDLE));
		return rb.getString(code);
	}
}
